<?php
namespace app\common\model\mysql;
use think\Model;

class Demo extends Model
{
    public function getDemoDataByCategoryId($categoryId, $limit = 10)
    {
        if(empty(intval($categoryId))){
            return [];
        }

        $results = $this->where("category_id",$categoryId)
            ->limit($limit)
            ->order("id","desc")
            ->select()
            ->toArray();

        return $results;
    }
}